package cn.taokuaidi.wangwang.client.mvc;

import cn.taokuaidi.wangwang.client.constants.AppEvents;
import cn.taokuaidi.wangwang.client.smart.AppConfig;
import cn.taokuaidi.wangwang.client.util.Screen;
import cn.taokuaidi.wangwang.client.widget.BaseEventCenter;

import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Dispatcher;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.VerticalPanel;

/**
 * @author 嘉陵江里捉鱼 email:tang7259@163.com
 *@version 1.0
 *@time Nov 23, 2008 10:45:56 AM
 */
public class View1680 extends LayoutContainer {

    private void loadData() {

    }

    public View1680() {
        Dispatcher.get().addController(new BaseEventCenter() {

            @Override
            public void handleEvent(AppEvent<?> event) {
                if (event.type == AppEvents.SELLER_DATA_LOADED) {
                    loadData();
                }
            }
        });
        HorizontalPanel vp = new HorizontalPanel();

        ContentPanel sellerPanel = new ContentPanel();
        sellerPanel.setHeading("卖出的");
        SellerView sellerView = new SellerView();
        sellerPanel.add(sellerView);
        sellerPanel.setTopComponent(sellerView.toolBar);
        sellerPanel.setCollapsible(true);
        vp.add(sellerPanel);

        VerticalPanel view2 = new VerticalPanel();
        ContentPanel statPanel = new ContentPanel();
        AppConfig appConfig = Screen.getAppConfig();
        statPanel.setWidth(appConfig.statWidth);
        statPanel.setHeight(appConfig.statHeight);
        statPanel.setHeading("统计图表");
        statPanel.add(new StatView());
        statPanel.setCollapsible(true);
        view2.add(statPanel);
        ContentPanel buyerPanel = new ContentPanel();
        buyerPanel.setHeading("买入的");
        buyerPanel.add(new BuyerView());
        buyerPanel.setWidth(appConfig.buyerGridWidth);
        buyerPanel.setHeight(appConfig.buyerGridHeight);
        buyerPanel.setCollapsible(true);
        view2.add(buyerPanel);

        vp.add(view2);
        // Screen Config
        vp.setSize(appConfig.vpWidth, appConfig.vpHeight);
        add(vp);

    }
}
